#ifndef WIDGETANCHOR_H
#define WIDGETANCHOR_H

#include <QObject>
#include <QWidget>
#include <QQuickItem>
#include <QTimer>
#include "dbHelper.h"

// 用于QML中嵌入QWidget的定位（但是好像不太好使）
class WidgetAnchor : public QObject
{
    Q_OBJECT
public:

    WidgetAnchor(QWidget* pWidget, QQuickItem* pItem);
    void updateGeometry();
    void updateVisible();

    void show();
    void hide();

//    void setQuickItem(QQuickItem* pItem);

signals:
    void sigRectChanged(int x, int y, int width, int height);      // x, y, width, height

private:
    QWidget*        _pWidget = nullptr;
    QQuickItem*     _pQuickItem = nullptr;

    bool            _visible = false;
};

#endif // WIDGETANCHOR_H
